# Maintainer: Willow Barraco <contact@willowbarraco.fr>
pkgname=sxmo-sway
pkgver=1.8.1
pkgrel=2
pkgdesc="i3-compatible window manager for Wayland - Sxmo version"
url="https://swaywm.org/"
license="MIT"
arch="all"
makedepends="
	cairo-dev
	eudev-dev
	gdk-pixbuf-dev
	json-c-dev
	libcap-utils
	libevdev-dev
	libinput-dev
	libxkbcommon-dev
	linux-pam-dev
	meson
	ninja
	pango-dev
	pcre2-dev
	scdoc
	wayland-dev
	wayland-protocols
	wlroots0.16-dev
	"
subpackages="
	$pkgname-dbg
	$pkgname-doc
	$pkgname-wallpapers::noarch
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~stacyharper/sway/archive/$pkgver.tar.gz
	fix-xkb-config-nice.patch
	sway.desktop
	remove-aports-git-version.patch
	no-werror.patch
	"
options="setcap !check" # no test suite
builddir="$srcdir"/sway-$pkgver

provides="sway-virtual"
provider_priority=10

build() {
	abuild-meson . output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	# for setting SCHED_RR scheduling policy
	# before starting the Wayland server
	setcap cap_sys_nice=+ep "$pkgdir"/usr/bin/sway

	install -D -m644 "$srcdir"/sway.desktop \
		-t "$pkgdir"/usr/share/wayland-sessions/
}

wallpapers() {
	pkgdesc="Wallpapers for Sway"
	license="CC0-1.0"
	install_if="$pkgname=$pkgver-r$pkgrel"

	amove usr/share/backgrounds
}

sha512sums="
80a4786b3b62d63008d21efbedabfb6db7feaf14b5f8c9669862988f446ad46878bd86142af6381ea23960f61fcd509c00609e2e9182767ff118afd39a6ad72f  sxmo-sway-1.8.1.tar.gz
cf61647f5c4f25d7a7b161bfd63b0210979d8ccb004e4e6b4f096f81cff4b899e9db6b3ce4107ea0ebddf14b1ec0b20b0d6a7944d66c68a74b0b70caa75b0c14  fix-xkb-config-nice.patch
c9bc08fbd9d059c037ad1e3b7ab5e91bcde27dce248cc558c1f126b01c85b1d0d4ed4bb10e3f27bc818a06e60a81f19478b95529d4eeb32036e2c6ea9f29db36  sway.desktop
3081f34ff88be38889ace94489ff4dc97a3d2d8402a6f2e83e968b991db478b7d3329d1685697898d8e43761e83be0d7c348a5fee45fe41dbb77521cda7b5a72  remove-aports-git-version.patch
4118a0a9d9fd173ad337e44534f4a21d744ec99c51b5196e4be4fcd7aa0f8d4a3b107a41dc48a15856790f34701692f5e12f26e000a6cf8d2dfd28ebce03dac1  no-werror.patch
"
